<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="renderer" content="webkit">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>博客</title>
	<link rel="stylesheet" href="/public/css/bootstrap.min.css" />
	<link rel="stylesheet" href="/public/css/font-awesome-4.7.0/css/font-awesome.min.css" />
  <link rel="stylesheet" href="/public/css/main.css" />
</head>
<body>
  <header class="header">
    <div class="banner"></div>
    <nav>
      <ul>
        {% if category == '' %}
        <li class="active"><a href="/">首页</a></li>
        {% else %}
        <li><a href="/">首页</a></li>
        {% endif %}

        {% for cate in categories %}
          {% if category == cate.id %}
          <li class="active"><a href="/?category={{cate.id}}">{{cate.name}}</a></li>
          {% else %}
          <li><a href="/?category={{cate.id}}">{{cate.name}}</a></li>
          {% endif %}
        {% endfor %}
      </ul>
    </nav>
  </header><!--/header-->

  <div class="container">

    <div class="row">
      <div class="col-md-8">
        <div class="main">
          <div class="contents">
            {% block content %}{% endblock %}
          </div>
        </div><!--/main-->
      </div>

      <div class="col-md-4">
        <div class="admin">
        </div><!--/admins-->

        {% if userInfo._id %}
        <!--userInfo-->
        <div class="box userInfo" id="userInfo">
          <h5>用户信息</h5>
          <p>用户名：<span class="colDark username">{{userInfo.username}}</span></p>
          {% if userInfo.isAdmin %}
          <p>
            <span class="colDanger info">您好，您是管理员</span>
            <a href="/admin">进入管理</a>
          </p>
          {% else %}
          <p><span class="colDanger info">你的临时id是：{{userInfo._id}}</span></p>
          {% endif %}
          <p class="text-align-right logout"><a href="javascript:;" id="logoutBtn">退出</a></p>
        </div><!--/userInfo-->
        {% else %}
        <!--login-->
        <div class="box login" id="login">
          <h5>登录</h5>
          <div class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-4 control-label">用户名：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" placeholder="name" name="username" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-4 control-label">密码：</label>
              <div class="col-sm-8">
                <input type="password" class="form-control" placeholder="password" name="password" />
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-12">
                <button type="button" class="btn btn-normal btn-block mb10">登录</button>
                <p class="text-align-right">
                  还没注册？ <a class="colMint" href="javascript:;">马上注册</a>
                </p>
                <p class="colWarning text-align-center"></p>
              </div>
            </div>
          </div>
        </div><!--/login-->

        <!--register-->
        <div class="box register" id="register" style="display:none;">
          <h5>注册</h5>
          <div class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-4 control-label">用户名：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" placeholder="name" name="username" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-4 control-label">密码：</label>
              <div class="col-sm-8">
                <input type="password" class="form-control" placeholder="password" name="password" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-4 control-label">确认密码：</label>
              <div class="col-sm-8">
                <input type="password" class="form-control" placeholder="password" name="repassword" />
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-12">
                <button type="button" class="btn btn-normal btn-block mb10">注册</button>
                <p class="text-align-right">
                  已有账号？ <a class="colMint" href="javascript:;">马上登录</a>
                </p>
                <p class="colWarning text-align-center"></p>
              </div>
            </div>
          </div>
        </div><!--/register-->
        {% endif %}
      </div>

    </div>

  </div><!--/container-->
<script src="/public/js/jquery.min.js"></script>
<script src="/public/js/bootstrap.min.js"></script>
<script src="/public/js/index.js"></script>
</body>
</html>
